"""This file contains core classes for common objects, and will need to be imported from probably every other component"""

# The resultitem class needs to be something that can:
#            * be displayed as a thumbnail
#            * identify a license
#            * have some identifier the backend can use to fetch the original
#            * 

class ResultItem(object):
    """Represents an item matching searched criteria (e.g. a Flickr photo)"""
    def __init__(self, id,  license, \
                 title=None, creator=None, link=None, \
                 tags=None thumb=None):
        """Must specify id and license."""
        self.id = id
        self.license = license
        self.title = title
        self.creator = creator
        self.link = link
        self.tags = tags
        self.thumb = thumb
        
    def __str__(self):
        return '<Returned search object %s>' % self.id
    
class License(object):
    """an enumeration of cc licences"""
    def __init__(self, id, text, link):
        self.id= id
        self.license = license
        self.text = text
        self.link = link
    def __str__(self):
        return '<License identifier: %s>' % self.text

class Request(object): 
    """The request is generated by a frontend/gui, and passed in this container to a backend for processing"""
    def __init__(self, tags, licenseid,  date=None):
        self.tags = tags
        self.licenseid = licenseid
        # it is permissable for the date to be empty (however, some backends may use a default value (e.g. Flickr)
        self.date = date
    def __str__(selfself):
        return '<Request container>'
    
